package com.datetest;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

/**
 * @Author: fxy
 * @Date: 2022/09/22/13:14
 * @Description:
 */
public class DateTest1 {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date=format.parse("2022-12-31 10:00:00");

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int day = calendar.get(Calendar.DAY_OF_MONTH);

        Calendar now = Calendar.getInstance();
        now.setTime(new Date());
        int maxDay = now.getActualMaximum(Calendar.DAY_OF_MONTH);

        calendar.set(Calendar.MONTH,now.get(Calendar.MONTH));
        calendar.set(Calendar.DAY_OF_MONTH,maxDay);
        Date startTime = calendar.getTime();

        calendar.add(Calendar.DAY_OF_YEAR,1);
        Date endTime = calendar.getTime();

    }
}
